<template>
  <div class="userPoint-list">
    <el-page-header @back="goBack" >
    </el-page-header>
    <div style="height: 60px">
      <el-button type="primary" @click="pointConfig" style="margin: 5px;float: right">配置</el-button>
    </div>
    <el-table
      stripe
      height="800"
      :data="userPointDataList"
      style="width: 100%"
    >
      <el-table-column
        align="center"
        label="点位名称"
        prop="point_name"
      >
      </el-table-column>
    </el-table>
    <point-config ref='point_config_dialog'/>
  </div>
</template>

<script>

  import pointConfig from "./pointConfigList";

  export default {
    name: "pointList",
    components: {pointConfig},
    methods: {
      queryData(){
        let me = this;
        this.$axios.post('userConfigRoutes', {
          action_type: 'pointQuery',
          user_id:me.$route.params.user_id,
          device_id:me.$route.params.device_id
        }).then(function (response) {
          me.userPointDataList = response.data.data;
        });
      },
      pointConfig() {
        this.$refs.point_config_dialog.pointConfigQuery();
      },
      goBack(){
        this.$router.push({name: 'deviceList', params: {user_id: this.$route.params.user_id,enterprise_id:this.$route.params.enterprise_id}})
      }
    },
    data() {
      return {
        userPointDataList : [],
      }
    },
    created() {
      let me = this;
      if(me.$route.params.user_id){
        if(me.$route.params.device_id ){
          me.queryData();
        }else{
          me.$router.push({name: 'deviceList', params: {user_id: this.$route.params.user_id,enterprise_id:this.$route.params.enterprise_id}});
        }

      }else{
        me.$router.push({name: 'userConfig'});
      }
    },

  }
</script>

<style lang="scss" scoped>
  .userPoint-list {
    background-color: #fff;
  }
</style>
